<!DOCTYPE html>
<?php
if (!isset($html_lang)) {
    if ($locale == "jp") {
        echo "<html lang='ja'>";
    } else if ($locale == "us" || $locale == "uk" || $locale == "ca") {
        echo "<html lang='en'>";
    }
} else {
    echo "<html lang='" . $locale . "'>";
}
?>
<head>
    <meta charset="UTF-8">
    <?php
    if (!isset($meta_keywords)) {

        echo "<meta name='keywords' content='" . "Amazon Associate tool,simple online tool,Amazon link to twitter,Amazon Associate for iPhone and Android" . "'>";
    } else {
        echo "<meta name='keywords' content='" . $metakeywords . "'>";
    }
    if (!isset($meta_description)) {
        echo "<meta name='description' content='" . "Associate* is simple online tool.Tweet Amazon associate link anywhere" . "'>";
    } else {
        echo "<meta name='description' content='" . $meta_description . "'>";
    }
    ?>
    <meta name="author" content="agniuek" />
    <meta name="msvalidate.01" content="B17F46571AEB8DF77AAD776AA1A4EE23" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
    <title><?php echo $config['meta_title']; ?></title>
    <link href="/css/style_sm.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="/css/jquery.mobile-1.2.0.min.css" />
    <script src="/js/jquery-1.8.2.min.js"></script>
    <script src="/js/jquery.mobile-1.2.0.min.js"></script>
    <script src="/js/custom.js"></script>
</head>
<body>
    <?php include_once("analyticstracking.php") ?>
    <div id="main_box" data-role="page" >
        <header id="top_header" data-role="header">
            <div id="logo">
                <a href="index.php?locale=<?php echo $locale ?>" >
                    <img src="/logo.png" alt="Associate*|tweet associate link anywhere"/>
                </a>
            </div>
            <p>Associate* | Tweet associate link anywhere.</p>
            <div id="top_ad" >
                <!--google adsense pc-->
                <div id="ad_pc">
                    <?php if ($userAgentManager->is_pc()) { ?>

                        <script type="text/javascript"><!--
                            google_ad_client = "ca-pub-4498051423313001";
                            /* mobazon ビッグバナー */
                            google_ad_slot = "9810971464";
                            google_ad_width = 728;
                            google_ad_height = 90;
                            //-->
                        </script>
                        <script type="text/javascript"
                                src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                        </script>

                    <?php } ?>
                </div>
                <!--google adsense mobile-->
                <div id="ad_mobile">
                    <?php
                    $GLOBALS['google']['client'] = 'ca-mb-pub-4498051423313001';
                    $GLOBALS['google']['https'] = read_global('HTTPS');
                    $GLOBALS['google']['ip'] = read_global('REMOTE_ADDR');
                    $GLOBALS['google']['markup'] = 'xhtml';
                    $GLOBALS['google']['output'] = 'xhtml';
                    $GLOBALS['google']['ref'] = read_global('HTTP_REFERER');
                    $GLOBALS['google']['slotname'] = '2098914663';
                    $GLOBALS['google']['url'] = read_global('HTTP_HOST') . read_global('REQUEST_URI');
                    $GLOBALS['google']['useragent'] = read_global('HTTP_USER_AGENT');
                    $google_dt = time();
                    google_set_screen_res();
                    google_set_muid();
                    google_set_via_and_accept();

                    function read_global($var) {
                        return isset($_SERVER[$var]) ? $_SERVER[$var] : '';
                    }

                    function google_append_url(&$url, $param, $value) {
                        $url .= '&' . $param . '=' . urlencode($value);
                    }

                    function google_append_globals(&$url, $param) {
                        google_append_url($url, $param, $GLOBALS['google'][$param]);
                    }

                    function google_append_color(&$url, $param) {
                        global $google_dt;
                        $color_array = explode(',', $GLOBALS['google'][$param]);
                        google_append_url($url, $param, $color_array[$google_dt % count($color_array)]);
                    }

                    function google_set_screen_res() {
                        $screen_res = read_global('HTTP_UA_PIXELS');
                        if ($screen_res == '') {
                            $screen_res = read_global('HTTP_X_UP_DEVCAP_SCREENPIXELS');
                        }
                        if ($screen_res == '') {
                            $screen_res = read_global('HTTP_X_JPHONE_DISPLAY');
                        }
                        $res_array = preg_split('/[x,*]/', $screen_res);
                        if (count($res_array) == 2) {
                            $GLOBALS['google']['u_w'] = $res_array[0];
                            $GLOBALS['google']['u_h'] = $res_array[1];
                        }
                    }

                    function google_set_muid() {
                        $muid = read_global('HTTP_X_DCMGUID');
                        if ($muid != '') {
                            $GLOBALS['google']['muid'] = $muid;
                            return;
                        }
                        $muid = read_global('HTTP_X_UP_SUBNO');
                        if ($muid != '') {
                            $GLOBALS['google']['muid'] = $muid;
                            return;
                        }
                        $muid = read_global('HTTP_X_JPHONE_UID');
                        if ($muid != '') {
                            $GLOBALS['google']['muid'] = $muid;
                            return;
                        }
                        $muid = read_global('HTTP_X_EM_UID');
                        if ($muid != '') {
                            $GLOBALS['google']['muid'] = $muid;
                            return;
                        }
                    }

                    function google_set_via_and_accept() {
                        $ua = read_global('HTTP_USER_AGENT');
                        if ($ua == '') {
                            $GLOBALS['google']['via'] = read_global('HTTP_VIA');
                            $GLOBALS['google']['accept'] = read_global('HTTP_ACCEPT');
                        }
                    }

                    function google_get_ad_url() {
                        $google_ad_url = 'http://pagead2.googlesyndication.com/pagead/ads?';
                        google_append_url($google_ad_url, 'dt', round(1000 * array_sum(explode(' ', microtime()))));
                        foreach ($GLOBALS['google'] as $param => $value) {
                            if (strpos($param, 'color_') === 0) {
                                google_append_color($google_ad_url, $param);
                            } else if (strpos($param, 'url') === 0) {
                                $google_scheme = ($GLOBALS['google']['https'] == 'on') ? 'https://' : 'http://';
                                google_append_url($google_ad_url, $param, $google_scheme . $GLOBALS['google'][$param]);
                            } else {
                                google_append_globals($google_ad_url, $param);
                            }
                        }
                        return $google_ad_url;
                    }

                    $google_ad_handle = @fopen(google_get_ad_url(), 'r');
                    if ($google_ad_handle) {
                        while (!feof($google_ad_handle)) {
                            echo fread($google_ad_handle, 8192);
                        }
                        fclose($google_ad_handle);
                    }
                    ?>
                </div>
            </div>
        </header>
        <div data-role="content">
            <div id="top_nav">
                <ul>
                    <li class="topLinks">
                        <a href="/index.php" data-ajax='false' class="topLinks">top</a>
                    </li>
                    <li class="topLinks">
                        <a href="http://clubamigokk.blogspot.jp/p/contact.html" class="topLinks">contact</a>
                </ul>
            </div>
            <div>
                <p> COUNTRIES:</p><?php echo $amazonAsocUtil->createLocaleLink($locale) ?>
            </div>
            <?php
            echo "<form name='f1' method='get' data-ajax='false' action='/" . $locale . "/index.php?'" . " >";
            ?>
            <div id="input_area">

                <label for="asoc_id">AMAZON ASSOCIATE ID:</label><input type="text" id="asoc_id" name="asoc_id" data-mini="true" value="<?php echo $asoc_id ?>" />
                <label for="keywords">KEYWORD:</label><input type="text" name="keywords" id="keywords" data-mini="true" value="<?php echo $keywords ?>" />
                <?php echo $searchIndexTag; ?>
                <label for="Search">SEARCH:</label>
                <input type="submit" id="Search" value="Search" />
                <input type="hidden" name="locale" value="<?php echo $locale ?>" >

            </div>
            <?php echo "</form>"; ?>
            <hr class="split" />
            <div id="search_result">
                <?php
                echo "<p>" . $total_result . " items.";
                echo "</p><br/>";
                echo $paging_link;
                ?>
                <hr class="split"/>
            </div>
            <div id="item_list">
                <?php
                echo $itemsearch_tags;
                ?>
                <hr class="split" />
            </div>
            <div id="search_result">
                <?php
                echo "<p>" . $total_result . " items.";
                echo "</p><br/>";
                echo $paging_link;
                ?>
                <hr class="split" />
            </div>
            <div id="qrcode">
                <h2>::QRCODE @Associate*::</h2>

                <img src="/qr.png" alt="qrcode" />

                <hr/>
            </div>
            <div id="future">
                <h2>::Future @Associate*::</h2>

                    <p>I correspond with respect to violations of the Amazon.The name mobazon is NG.</p>
                    <p>Bugfix.</p>
                    <p>Some social button. </p>
                    <p>Item detail infomation.</p>
                    <p>And more...</p>

                <hr/>
            </div>

            <div id="updated">
                <h2>::Update @Associate*::</h2>
                <p> 2013.02.20 add buttons  </p>
                <p> 2013.02.21 successfully checked as HTML5</p>
                <p> 2013.02.25 asociate id save to sesssion.</p>
                <hr/>
            </div>
            <div id="rss_feed">
                <h2>::RSS FEED @Associate*::</h2>
                <p><a href="http://page2rss.com/rss/4a47f1981e0d654098f807bb966a62ed"><img src="/images/rss.png" alt="RSS">RSS</a></p>

                <hr/>
            </div>
            <div>
                <!-- Start SocialFollow.com Button Code -->
                <img src="http://www.socialfollow.com/button/image/?b=18425" class="socialFollowImage" alt="Follow Me!" />
                <script type="text/javascript" src="http://www.socialfollow.com/button/?b=18425"></script>
                <script type="text/javascript">socialfollow.init("socialFollowImage");</script>
                <!-- End SocialFollow.com Button Code -->
            </div>

        </div>
        <footer id="the_footer" data-role=“footer” >

            <div id="copyright">Copyright © 2013 the <a href="http://clubamigokk.blogspot.jp/">App*Rocks</a> All rights reserved.</div>
        </footer>
    </div><!--main-->
    <!--analytics-->
    <?php
    $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl();
    echo "<img src='" . $googleAnalyticsImageUrl . "'" . " alt='analytics' />";
    ?>

</body>
<?php unset($amazonAsocUtil) ?>
</html>